#ifndef LIMAGE_H
#define LIMAGE_H
#include <QImage>
#include <iostream>
#include <QString>
#include <QPixmap>
#include <math.h>

#include "histogram.h"
#include "histogramGray.h"
#include "histogramRGB.h"
#include "histogramhsi.h"
#include "histogramyuv.h"

class LImage
{
private :
    QImage image;
    LImage mergeGrayImage(double,LImage,double);
    LImage mergeColorImage(double,LImage,double);
    LImage RGBHistogramEqualization();
    LImage grayHistogramEqualization();
    QImage rotate90clock(QImage);
    QImage rotate90counterclock(QImage);


public:
    Histogram* histogram;
    LImage();
    LImage(QImage qImage);
    LImage(int,int,QImage::Format);
    LImage(QString);
    LImage(QString,char);
    ~LImage();
    LImage convertToGrayScale(); //

    LImage convertToNegative();
    QImage getImage();
    LImage convertToColorNegative(); //


    void loadLimage(QString path);
    void saveImage(QString);
    LImage normalizeImage();
    LImage mergeImage(double,LImage,double);
    LImage mergeImages(LImage other, double coef, int posx, int posy); //Implemented by Daniel
    QRgb pixel(int,int);
    void setPixel(int,int,int,int,int);
    void setPixel(int,int,double,double,double);
    LImage HSIHistogramEqualization();
    LImage grayHistogramStretching();
    LImage colorHSIHistogramStretching();
    LImage intelligentScissors();
    void calcHistogram();
    QPixmap getPixmap();
    QImage getHistogramImage();
    QImage getHistogramYUVImage();
    LImage histogramEqualization();
    LImage histogramStretching();

    //FUNCTIONS
    LImage crop(int startx, int starty, int endx, int endy);
    LImage resizeAverage(int newwidth, int newheight);
    LImage resizeBilinear(int newwidth, int newheight);
    QImage rotateclock(int angle);
    QImage rotatecounterclock(int angle);

};

#endif // LIMAGE_H
